//
//  DSFUserInfo.h
//  TVFan3.0
//
//  Created by suma on 14-9-16.
//  Copyright (c) 2014年 李胜男. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MTLModel.h"
#import "AFAppDotNetAPIClient.h"
//#import "SJModel.h"
#import "JSONModelLib.h"

@class ClassModel;
@class SubjectModel;
@class ClassUserMoedel;
@class GradeModel;

@interface DSFUserInfo : NSObject

@property (nonatomic, retain) NSString *token;//令牌
@property (nonatomic, assign) double userId;//班级成员id
@property (nonatomic, retain) NSString * phone;
@property (nonatomic, assign) long sex;
@property (nonatomic, retain) NSString * icon;//头像地址
@property (nonatomic, retain) NSString * last_login_time;//班级名称
@property (nonatomic, retain) ClassUserMoedel * clazz_user;
@property (nonatomic, assign) BOOL isTeachLogin;
//@property (nonatomic, assign) long noticeCount;//用户账户信息存储
//@property (nonatomic, assign) long messageCount;//是否从第三方平台登录

//判断是否登陆
@property (nonatomic, assign) BOOL isLogin;


+ (DSFUserInfo *)shareUserInstance;
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

//--登录
+ (NSURLSessionDataTask *)userLogin:(void (^)(BOOL result,NSError *error))block withUsername:(NSString *)username andPassword:(NSString *)password andUserType:(int)userType andPushUserId:(NSString *)pushUserId andImei:(NSString *)imei;
//--退出
+ (NSURLSessionDataTask *)userLogout:(void (^)(BOOL result, NSError *))block;

//--获取班级成员信息
+ (NSURLSessionDataTask *)getClazzUsers:(void (^)(BOOL result,NSArray *classUserArr,NSError *error))block withToken:(NSString *)token andClazzId:(int)clazzId;

//--获取我的收藏
+ (NSURLSessionDataTask *)getMyCollects:(void (^)(BOOL result,NSArray *classUserArr,NSError *error))block withPageNumber:(NSInteger)pageNumber withPageSize:(NSInteger)pageSize;

//--获取邀请码
+ (NSURLSessionDataTask *)getMyInvitationCode:(void (^)(BOOL result,NSString *code,NSError *error))block;

//--通过邀请码注册家长(针对已登录用户)
+ (NSURLSessionDataTask *)regist:(void (^)(BOOL result,NSError *error))block withToken:(NSString *)token andInvitationCode:(NSString *)invitationCode andRelation:(NSString *)relation;

//--通过邀请码注册为家庭成员并登录(针对新用户)
+ (NSURLSessionDataTask *)registWithLogin:(void (^)(BOOL result,NSError *error))block withUsername:(NSString *)username andPassword:(NSString *)password andUserType:(NSInteger)userType andPushUserId:(NSString *)pushUserId andInvitationCode:(NSString *)invitationCode andRelation:(NSString *)relation icon:(NSString *)icon;

//--获取我的家庭成员
+ (NSURLSessionDataTask *)getMyFamilyMembers:(void (^)(BOOL result,NSString *failMessage,NSArray *familyMembers,NSError *error))block withToken:(NSString *)token andClazzId:(int)clazzId;


@end

@interface ClassUserMoedel :MTLModel

@property (nonatomic, assign) NSInteger invitation_code;
@property (nonatomic, retain) NSString  * nickname;
@property (nonatomic, assign) NSInteger role;/**<角色,1-班主任,2-科目老师,3-学生家长代表,4-家委会委员,5-普通学生家长*/
@property (nonatomic, assign) NSInteger is_default;
@property (nonatomic, assign) NSInteger is_master;
@property (nonatomic, retain) NSString  * relation;
@property (nonatomic, retain) NSString  * student_name;

@property (nonatomic, retain) ClassModel<  Optional > * clazz;
@property (nonatomic, retain) SubjectModel<Optional > *subject;
@end

@interface ClassModel : MTLModel

@property (nonatomic, assign) int        id;
@property (nonatomic, retain) NSString   *name;
@property (nonatomic, retain) NSString   *alias;
@property (nonatomic, retain) GradeModel *grade;

@end



@interface GradeModel : MTLModel

@property (nonatomic, assign) int        id;
@property (nonatomic, retain) NSString   *name;
@property (nonatomic, assign) int        type;
@property (nonatomic, assign) int        enrollment_year;
@property (nonatomic, retain) NSString   *description;

@end

@interface SubjectModel : MTLModel

@property (nonatomic, assign) int        id;
@property (nonatomic, retain) NSString   *name;
@property (nonatomic, retain) NSString   *intro;

@end

@interface OtherClassModel : MTLModel

@property (nonatomic, retain) NSString   *icon;
@property (nonatomic, assign) NSInteger  id;
@property (nonatomic, assign) NSInteger  is_default;
@property (nonatomic, retain) NSString   *nickname;
@property (nonatomic, assign) NSInteger  role;
@property (nonatomic, assign) NSInteger  sex;
@property (nonatomic, assign) NSInteger  user_type;

@end

@interface FamilyMember : MTLModel

@property (nonatomic, assign) NSInteger  id;
@property (nonatomic, retain) NSString   *nickname;
@property (nonatomic, retain) NSString   *relation;
@property (nonatomic, assign) NSInteger  sex;
@property (nonatomic, retain) NSString   *icon;

@end

@interface CollectModel : MTLModel

@property (nonatomic, assign) NSInteger  id;
@property (nonatomic, assign) NSInteger  type;
@property (nonatomic, retain) NSString   *title;
@property (nonatomic, retain) NSString   *content;
@property (nonatomic, retain) NSString   *image1;
@property (nonatomic, assign) NSInteger  visible_range;
@property (nonatomic, assign) NSInteger  is_allow_comment;
@property (nonatomic, assign) NSInteger  student_id;
@property (nonatomic, assign) NSInteger  registration_mode;
@property (nonatomic, assign) NSInteger  read_count;
@property (nonatomic, assign) NSInteger  comment_count;
@property (nonatomic, assign) NSInteger  registration_count;
@property (nonatomic, retain) NSString   *create_time;

@end

